<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>添加合作渠道</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
    <style type="text/css">
        .index-outside > section .section-main {
            min-width: 0px !important;
            max-width: 800px !important;
        }

        .index-outside > section {
            padding-bottom: 0px !important;
        }

        .index-outside > section .section-main {
            margin-bottom: 0px;
            padding: 15px 25px;
        }

        .index-outside .f-search-bar {
            border: 0px;
        }

        .preview-content .content {
            display: flex;
            justify-content: space-around;
            text-align: center;
        }

        .preview-content .content .inner-item {
            margin: 25px 25px 0px 25px;
        }

        .preview-content .content .dialog-img {
            width: 220px;
            box-shadow: 0 0 40px #ccc;
        }

        .preview-content .inner-item .inner-text {
            margin-top: 15px;
        }
    </style>
</head>
<body>
<!--头部-->
<div class="index-outside">
    <!--内容-->
    <section class="no-fix">
        <div class="section-main">
            <form class="layui-form" action="" id="myForm" method="post">
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">添加合作渠道</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="mobile" autocomplete="off" class="layui-input"
                                           value="${member.mobile}" placeholder="请输入手机号" style="width: 200px;">
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="c-time-list-content preview-content" style="padding-top: 0px;">
                <p>合作渠道下载“CEO社群联盟APP”使用手机号登录后，即可查看项目的推广数据</p>
                <div class="content">
                    <div class="inner-item">
                        <img src="${ctx}/image/dialog/ceo_1.jpg" class="dialog-img" alt=""/>
                        <p class="inner-text">项目列表</p>
                    </div>
                    <div class="inner-item">
                        <img src="${ctx}/image/dialog/ceo_2.jpg" class="dialog-img" alt=""/>
                        <p class="inner-text">项目数据</p>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<!--底部-->
<%@include file="../include/incScript.jsp" %>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">
    function doSubmit() {
        var mobile = $("[name=mobile]").val().trim();
        if (!util.isValid(mobile)) {
            util.layerMsgError("请输入手机号")
            return false;
        } else if (util.isValid(mobile)) {
            if (!util.checkMobile(mobile)) {
                util.layerMsgError("手机号格式错误")
                return false;
            }
        }

        var isRepeat = false;
        ajaxSubmit({
            activityId : '${activityId}',
            mobile : mobile
        }, '${ctx}/activity/zcActivity/bindRelationZcActivity.do', function (res) {
            isRepeat = res.success;
            if (res.success) {
                util.layerMsgSuccess("添加合作渠道成功")
            } else {
                util.layerMsgError(res.description || "添加合作渠道失败")
            }
        });
        return isRepeat;
    }

    function ajaxSubmit(data, url, cb) {
        $.ajax({
            type: 'POST',
            async: false, // 使用同步的方法
            data: data,
            dataType: 'json',
            success: function (result) {
                typeof cb === 'function' && cb(result);
            },
            url: url
        });
    }
</script>
</body>
</html>